package com.yugao.fintech.draper.hazelcast.config;

import com.yugao.fintech.draper.hazelcast.support.HazelcastClientFactory;
import com.yugao.fintech.draper.hazelcast.support.HazelcastProperties;
import com.yugao.fintech.draper.hazelcast.support.HazelcastServerInstance;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;

@AutoConfiguration
public class HazelcastClientAutoConfiguration {
	@Bean
	HazelcastClientFactory hazelcastInstance(HazelcastProperties properties,
			ObjectProvider<HazelcastServerInstance> serverInstances) {
		return new HazelcastClientFactory(properties, serverInstances.getIfAvailable());
	}
}
